//
//  RequestParam.m
//  TrainTree
//
//  Created by wanghui on 2017/8/25.
//  Copyright © 2017年 YouYeShu. All rights reserved.
//

#import "RequestParam.h"

@implementation RequestParam

+ (instancetype)shareParameters {
    static RequestParam *singleParam;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        singleParam = [[RequestParam alloc] init];
    });
    return singleParam;
}

- (id)init
{
    if (self = [super init]) {
        _generationParam = [[NSMutableDictionary alloc]init];
    }
    return self;
}



- (void)setString:(NSString *)value forKey:(NSString *)key
{
    assert(key != nil);
    if (value == nil)
        [_generationParam removeObjectForKey:key];
    else
        [_generationParam setObject:value forKey:key];

}

- (NSString*)stringForKey:(NSString*)key
{
    return [_generationParam objectForKey:key];
}



- (void)setNumber:(NSNumber *)number forKey:(NSString *)key
{
    if (number) {
        [_generationParam setObject:number forKey:key];
    }
}
@end
